
package com.aiti.lulian.config;

import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.unit.DataSize;

import javax.servlet.MultipartConfigElement;


/**
 * @Author ZhouS
 * @CreateDate 2022-06-07
 * @Description:
 */

@Configuration
public class MultipartConfig {

    @Bean
    public MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
        //  单个数据大小
        factory.setMaxFileSize(DataSize.parse("102400000KB"));
        /// 总上传数据大小32000
        factory.setMaxRequestSize(DataSize.parse("32000000000KB"));
        factory.setFileSizeThreshold(DataSize.parse("3000000000000KB"));
        return factory.createMultipartConfig();
    }

}

